package com.hnguigu.health.houduan.lq.service_lq.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hnguigu.health.houduan.lq.service_lq.TMealsService;
import com.hnguigu.health.mapper.TMealsMapper;
import com.hnguigu.health.mapper.TMealsTypeMapper;
import com.hnguigu.health.pojo.TMeals;
import com.hnguigu.health.pojo.TMealsType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TMealsServiceImpl  implements TMealsService {
    @Autowired(required = false)
    TMealsMapper tMealsMapper;

    @Autowired(required = false)
    TMealsTypeMapper tMealsTypeMapper;

    @Override
    public PageInfo<TMeals> selectAllTMeals(int page, int num ,String content) {
        PageHelper.startPage(page,num);
        return new PageInfo<>(tMealsMapper.selectAllTMeals(content));
    }

    @Override
    public int insertSelective(TMeals record) {
        return tMealsMapper.insertSelective(record);
    }

    @Override
    public int updateByPrimaryKeySelective(TMeals record) {
        return tMealsMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return tMealsMapper.deleteByPrimaryKey(id);
    }

    @Override
    public List<TMealsType> findAll() {
        return tMealsTypeMapper.findAll();
    }

    @Override
    public TMeals getBycode(String name) {
        return tMealsMapper.getBycode(name);
    }

    @Override
    public TMeals Lastbean() {
        return tMealsMapper.Lastbean();
    }
}
